PrizmDoc
Mouse Tools

Mouse tools are named, customizable instances that can be used by any Viewing Client instance. Each mouse tool has a type, which determines how the tool behaves and the properties the tool has.

Mouse Tool Names

Mouse tools are given a name when a mouse tool is created. This name is used to get and set the mouse tool that is used by the Viewing Client:

Example
Copy Code
// The name of a new mouse tool
var myMouseToolName = "MyLineTool";

// Create the new mouse tool
PCCViewer.MouseTools.createMouseTool(
    myMouseToolName,
    PCCViewer.MouseTool.Type.LineAnnotation);

// Set the current mouse tool of the ViewerControl by passing the name
viewerControl.setCurrentMouseTool(myMouseToolName);

The mouse tool name also specifies the new mouse tool in the MouseToolChanged event:

Example
Copy Code
// The MouseToolChanged event triggers when the mouse tool changed.
// Use the ViewerControl#getCurrentMouseTool() method or event#mouseToolName property
// to get the new mouse tool name.
viewerControl.on("MouseToolChanged", function(ev) {
    viewerControl.getCurrentMouseTool() == ev.mouseToolName;  // true
});

Mouse Tool Objects

PCCViewer.MouseTool objects represent mouse tools, and the objects can be used to configure the mouse tools.

These objects are returned when creating a mouse tool with method PCCViewer.MouseTools.createMouseTool(...). The object can be retrieved at a later time using the method PCCViewer.MouseTools.getMouseTool():

Example
Copy Code
// Get the MouseTool object for an existing tool
var myMouseTool = PCCViewer.MouseTools.getMouseTool(myMouseToolName);

The MouseTool object has getters for the tool name and type:

Example
Copy Code
myMouseTool.getName(); // returns "MyLineTool"
myMouseTool.getType(); // returns "LineAnnotation"

Depending on the tool type, additional getters or setters may be available to configure the tool:

Example
Copy Code
// All mouse tools that draw a mark (annotation and redaction) have a
// getter `getTemplateMark()`
if (myMouseTool.getType() === "LineAnnotation") {
    // The method gives access to a template mark that configures how the tool draw
    // the annotation or redaction.
    // In this example the mouse tool is configured to draw a red line.
    myMouseTool.getTemplateMark().setColor("#FF0000");
}

Mouse Tool Type

Multiple Mouse Tools of one Type

Creating multiple mouse tools of one type is useful if several pre-defined behaviors are needed for one type of mouse tool. For example, this gives the ability to create two text highlighter tools, one that highlights red and the other that highlights green:

Example
Copy Code
// Create the red highlighter
PCCViewer.MouseTools.createMouseTool(
    "RedHighlighter",
    PCCViewer.MouseTool.Type.HighlightAnnotation)
        .getTemplateMark()
            .setFillColor("#FF0000");

// Create the green highlighter
PCCViewer.MouseTools.createMouseTool(
    "GreenHighlighter",
    PCCViewer.MouseTool.Type.HighlightAnnotation)
        .getTemplateMark()
            .setFillColor("#00FF00");

Pre-defined Named Mouse Tools

The file viewercontrol.js creates several named mouse tools as listed in the table below. These named mouse tools are used by the Viewing Client out-of-the-box.

Name

Type

"AccusoftMagnifier"

PCCViewer.MouseTool.Type.Magnifier

"AccusoftSelectToZoom"

PCCViewer.MouseTool.Type.SelectToZoom

"AccusoftPan"

PCCViewer.MouseTool.Type.Pan

"AccusoftPanAndEdit"

PCCViewer.MouseTool.Type.PanAndEdit

"AccusoftSelectText"

PCCViewer.MouseTool.Type.SelectText

"AccusoftEditMarks"

PCCViewer.MouseTool.Type.EditMarks

"AccusoftLineAnnotation"

PCCViewer.MouseTool.Type.LineAnnotation

"AccusoftArrowAnnotation"

PCCViewer.MouseTool.Type.LineAnnotation

"AccusoftRectangleAnnotation"

PCCViewer.MouseTool.Type.RectangleAnnotation

"AccusoftEllipseAnnotation"

PCCViewer.MouseTool.Type.EllipseAnnotation

"AccusoftTextAnnotation"

PCCViewer.MouseTool.Type.TextAnnotation

"AccusoftStampAnnotation"

PCCViewer.MouseTool.Type.StampAnnotation

"AccusoftHighlightAnnotation"

PCCViewer.MouseTool.Type.HighlightAnnotation

"AccusoftRectangleRedaction"

PCCViewer.MouseTool.Type.RectangleRedaction

"AccusoftTransparentRectangleRedaction"

PCCViewer.MouseTool.Type.TransparentRectangleRedaction

"AccusoftTextRedaction"

PCCViewer.MouseTool.Type.TextRedaction

"AccusoftStampRedaction"

PCCViewer.MouseTool.Type.StampRedaction

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback